package mystatic.a03demo3;

import java.util.ArrayList;

public class StudentUtil {
    //私有化构造方法
    private StudentUtil() {
    }

    //用于获取集合中最大学生的年龄
    public static int getAgeMaxStudent(ArrayList<Student> list) {
        //给定一个参照物
        int max = list.get(0).getAge();

        for (int i = 1; i < list.size(); i++) {
            int tmpAge = list.get(i).getAge();
            if (tmpAge > max) {
                max = tmpAge;
            }
        }
        return max;
    }
}
